Load Balancer is an ActiveX component that uses remote Performance Monitor statistics gathering as a basis for software-based load balancing.
Load Balancer leverages the power of remote collection of PerfMon statistics to provide dynamic ranking of server activity across multiple servers from a single location. The component's Start method creates a worker thread which continuously polls a user defined list of servers for a specified PerfMon statistic, and re-orders the list based on the resulting values. At the programmer's discretion, the order can be specified as either ascending or descending, depending on the nature of the statistic.
The preferred server can be read at any time, and subsequently used, for example, in ASP redirection. This can be done by invoking the GetPreferredServer method from within ASP and using this value within a Response.Redirect call. This can be incorporated into an application which makes use of several servers, but requires user sessions to be conducted in their entirety on the same server.
Load Balancer offers an example of an IIS 4.0 application-level component, one which is shared across all potential users of a site. The object is instantiated once, when the first user accesses the application, at which time a worker thread begins collecting PerfMon statistics and, thereafter, continuously re-ranks its server list. Data synchronization protects all callers from reading a server name while the component is re-ranking its internal server list. Since the component is "Agile" (supports the Free Threaded Marshaller), it can be used as an Active Server application-level object without the performance degradation caused by method serialization. For an example of this usage, see the accompanying ASP samples.
The component also features a manual read mode which makes it useful for doing remote PerfMon statistics gathering for any purpose. For an example, see the Visual Basic sample application "Readperf." This program is also an excellent tool for debugging and spot checking of PerfMon statistics.
As the Load Balancer component is an Automation server, it can be used by any Automation client. See the accompanying examples for usage in Active Server Pages illustrating automatic mode, and in Visual Basic 5.0 illustrating manual mode.
To install Load Balancer, copy the Loadbal.dll into the winnt\system32 directory (or wherever your Windows NT \system32 directory is) and from a command prompt, typing
regsvr32 c:\winnt\system32\Loadbal.dll
ReadCounter
AddServer
Init
DeInit
Start
Stop
GetPreferredServer